Component(
  {
    properties: {

    },
    data: {
      scene: null,
      gltfNode: null,
      helmet: null,
      rotationTimer: null,
      angle: 0,
    },
    methods: {
      handleReady(res) {
        console.log('加载完成 ===>', res)
        this.scene = res.detail.value
        const xrFrameSystem = wx.getXrFrameSystem()
        this.helmet = { el: this.scene.getElementById('gltf'), color: 'rgba(44, 44, 44, 0.5)' }
      },
      handleGLTFLoaded() {
        console.log('模型加载完成 ===>', this.helmet)
        // this.startRotation()
      },
      startRotation() {
        if (this.rotationTimer)
          clearInterval(this.rotationTimer)
        console.log('iiii ', this.helmet.el)
        this.rotationTimer = setInterval(() => {
          if (!this.helmet) { return }
          this.angle += 0.5 // 每次加 0.5 度，控制旋转速度
          if (this.angle >= 360)
            this.angle -= 360

          this.helmet.el.setData({
            rotation: [0, this.angle, 0],
          })
        }, 16) // 约 60fps
      },
    },
  },
)
